﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ParkingLot.Utility
{
    public class BytesHelp
    {
        public static int GetValue(byte[] bytes)
        {
            if (bytes.Length != 4)
            {
                return -1;
            }

            uint uintResult = 0;
            for (int i = 0; i < bytes.Length; i++)
            {
                uintResult = uintResult * 256 + bytes[i];
            }

            return (int)uintResult;
        }

        public static int GetValue(byte byteHead, byte byteEnd)
        {
            UInt16 uintResult = (UInt16)(byteHead * 256 + byteEnd);
            Int16 intResult = (short)uintResult;
            return (int)intResult;
        }


    }
}
